home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / manual-p / vh-man2h.000 / vh-man2h / vh-man2html-1.3 / netscape-man < prev    next >
Text File  |  1996-04-25  |  1KB  |  49 lines

  1. #!/bin/sh
  2. #
  3. # Man2hmtl interface to a live (already running) netscape browser.
  4. # Michael Hamilton <michael@actrix.gen.nz>, Apr 1996
  5. #
  6. # Usage examples:
  7. #        man 1                  - section 1 index
  8. #        man 3 intro            - section 3 name+description index
  9. #        man 1 lpr              - man page for lpr
  10. #        man -k editor          - search
  11. #
  12. function nsfunc () {
  13.     if ( /bin/ps -xc | grep -q 'netscape$' ) ; then
  14.         if [ -x  netscape-remote ] ; then
  15.             exec netscape-remote  -remote "openURL($1,new_window)"
  16.         else
  17.             exec netscape -remote "openURL($1,new_window)"
  18.         fi
  19.     else
  20.         netscape $1 &
  21.     fi
  22. }
  23.  
  24. if [ $# = 2 ] ; then
  25.     case "$1" in
  26.       -k)
  27.           nsfunc "http:/cgi-bin/mansearch?$2"
  28.           ;;
  29.       *)
  30.           if [ $2 = 'intro' ] ; then
  31.         nsfunc "http:/cgi-bin/manwhatis?$1"
  32.           else
  33.         nsfunc "http:/cgi-bin/man2html?$2+$1"
  34.           fi
  35.           ;;
  36.     esac
  37. else
  38.     case "$1" in
  39.       1|2|3|4|5|6|7|8)
  40.           nsfunc "http:/cgi-bin/mansec?$1"
  41.           ;;
  42.       *)
  43.           nsfunc "http:/cgi-bin/man2html?$1"
  44.           ;;
  45.     esac
  46. fi
  47.     
  48.